//
//  secondDisViewController.m
//  TinyFortune
//
//  Created by lc on 16/6/13.
//  Copyright © 2016年 lc. All rights reserved.
//

#import "secondDisViewController.h"

@interface secondDisViewController ()

@property (strong, nonatomic) IBOutlet UITableView *detailTaileView;
@property (weak, nonatomic) IBOutlet UITextView *describeTextView;//概况
@property (weak, nonatomic) IBOutlet UITextView *wayOfArrived;//到达方式
@property (weak, nonatomic) IBOutlet UITextView *addressTextField;//地址
@property (weak, nonatomic) IBOutlet UITextView *openTimeTextField;//开放时间
@property (weak, nonatomic) IBOutlet UITextView *priceTextField;//门票价格

@end

@implementation secondDisViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self createUI];
    [self setTableViewData]; //填充该界面的数据
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
- (void)createUI{
    //实例化导航条
    UIBarButtonItem *leftBar = [[UIBarButtonItem alloc]initWithTitle:@"返回" style:UIBarButtonItemStylePlain target:self action:@selector(onClicked)];
    [self.navigationItem setLeftBarButtonItem:leftBar];
    self.navigationController.navigationBar.translucent = NO ;
    [self.navigationController setNavigationBarHidden:NO];
    [self.navigationController.navigationBar setBarTintColor:[UIColor colorWithRed:86/255.0f green:202/255.0f blue:255/255.0f alpha:0.5]];
    [self.navigationController.navigationBar setBarStyle:UIBarStyleBlack];
    [self.navigationController.navigationBar setTintColor:[UIColor whiteColor]];
    [self setTitle:@"详情"];
    
    //添加滑动手势
    UISwipeGestureRecognizer *rightSwip = [[UISwipeGestureRecognizer alloc]initWithTarget:self action:@selector(rightGo)];
    [self.view addGestureRecognizer:rightSwip];
    [rightSwip setDirection:UISwipeGestureRecognizerDirectionRight];
}
#pragma mark - 点击事件
- (void)rightGo{
    [self onClicked];
}

- (void)onClicked{
    [self.navigationController popViewControllerAnimated:NO];
    
}
#pragma mark - 填充该界面的数据
-(void)setTableViewData{
    
    //头视图
    UIImageView * headerView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, WIDTH, WIDTH * 3.8 / 5 )];
    
    [_detailTaileView setTableHeaderView:headerView];
    
    [headerView sd_setImageWithURL:[NSURL URLWithString:_model.cover_s] placeholderImage:nil];
    
    //描述
    [_describeTextView setText:_model.desc.length?_model.desc:@"还没有描述哟！"];
    
    //地址
    [_addressTextField setText:_model.address];
    
    //到达方式
    [_wayOfArrived setText:_model.arrival_type.length?_model.arrival_type:@"暂无该信息"];
    
    //开放时间
    [_openTimeTextField setText:_model.opening_time.length?_model.opening_time:@"暂无该信息"];

    //门票价格
    [_priceTextField setText:_model.fee.length?_model.fee:@"无"];
}

@end
